{include file=$header_start}
{strip}
<link rel="stylesheet" type="text/css" href="{$siteroot}/templates/default/style/registration.css">
<script src="{$siteroot}/includes/js/admin/ajax.js" type="text/javascript" ></script>
{/strip}
{literal}
<script type="text/javascript">
function getSelectedCheckbox(buttonGroup) {
   // Go through all the check boxes. return an array of all the ones
   // that are selected (their position numbers). if no boxes were checked,
   // returned array will be empty (length will be zero)
   var retArr = new Array();
   var lastElement = 0;
   if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)
      for (var i=0; i<buttonGroup.length; i++) {
         if (buttonGroup[i].selected) {
            retArr.length = lastElement;
            retArr[lastElement] = i;
            lastElement++;
         }
      }
   } else { // There is only one check box (it's not an array)
      if (buttonGroup.selected) { // if the one check box is checked
         retArr.length = lastElement;
         retArr[lastElement] = 0; // return zero as the only array value
      }
   }
   return retArr;
} // Ends the "getSelectedCheckbox" function
  
  function getSelectedCheckboxValue(buttonGroup) {
   // return an array of values selected in the check box group. if no boxes
   // were checked, returned array will be empty (length will be zero)
   var retArr = new Array(); // set up empty array for the return values
   var selectedItems = getSelectedCheckbox(buttonGroup);
   if (selectedItems.length != 0) { // if there was something selected
      retArr.length = selectedItems.length;
      for (var i=0; i<selectedItems.length; i++) {
         if (buttonGroup[selectedItems[i]]) { // Make sure it's an array
            retArr[i] = buttonGroup[selectedItems[i]].value;
         } else { // It's not an array (there's just one check box and it's selected)
            retArr[i] = buttonGroup.value;// return that value
         }
      }
   }
   return retArr;
}

function in_array(array, id) {
    for(var i=0;i<array.length;i++) {
        if(array[i][0] === id) {
            return true;
        }
    }
    return false;
}

function showJobType(k){
	
	if(k!='')
		document.getElementById("checkfirst").style.display='block';
	else
		document.getElementById("checkfirst").style.display='none';	
	var namecat = document.getElementsByName("catname[]");
	var newstr='';
	var myArray=new Array(); 
	for(var i=0; i< namecat.length;i++)
	{
		var str ='';
		str = namecat.item(i).value;
		
		if(str !='')
		{
			
			if(in_array(myArray, str))
			{
				document.getElementById("catname_"+i).value='';
				alert("Please select different category!");
				return false;				
			}
			else
			{
				myArray[i] =str;
				if(newstr == '')
				{
					newstr=str;	
				}
				else
				{
					newstr = newstr+','+str;	
				}
			}
			
		}
	}
	//alert(newstr);
//	return false;
//		var fl = 0;
//	var chk_arr = new Array();
//	var checkBoxArr = getSelectedCheckboxValue(document.frmTradesmanAdd.catname);	
	//alert(checkBoxArr);
	//document.getElementById('hidediv').style.display='block';
	if(k!='')
		ajax.sendrequest("GET",SITEROOT + "/modules/register/show_jobtype.php",{jid:newstr},"","isJobType");
}

</script>
{/literal}

{include file=$header_end}

<!-- MIDDLE CONTAIN GOES HERE -->
<section class="inner_wrapper">
<section class="middle_portion">
	<h1 class="registr_head">registration</h1>
    <section class="regis_steps_breadcrum_wrapper">
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step1_ho.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step2.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step3.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step4.png"></section>
        <section class="lF"><img src="{$siteroot}/templates/default/images/register_steps/registr_step5.png"></section>
        <section class="clear"></section>
    </section>    
        <span class="lF">
            <h2 class="heading2">Provider Registration</h2>    
        </span>                 
     <section class="clear"></section>
    <form id="frmTradesmanAdd" name="frmTradesmanAdd" method="POST" action="{$siteroot}/register/step2/">   
    <section class="regist_form no_bor">
      <h1>select your trade</h1>
      <div id = "feeratetable1">
    	<dl class="minht70">
        
        <table width="100%">
        	<thead>
            	<tr>
                    <th>No</th>
                    <th>Category Name</th>
                    <th>Expiry time</th>
                    <th>Price</th>
                </tr>
            </thead>
            <tbody>
            {section name=i loop=$newtradecategoryArray}
            	<tr>
                	<td>{$i}</td>
                	<td>{$newtradecategoryArray[i].trade_category}</td>
                	<td></td>
                	<td></td>
                 </tr>
             {/section}     
            </tbody>
        </table>
        
        <select class="input3" name="catname[]" id="catname_0" onchange="showJobType(this.value);">
            <option value="">Select trade category</option>
            {section name=i loop=$newtradecategoryArray}
                <option value="{$newtradecategoryArray[i].id}">{$newtradecategoryArray[i].trade_category}</option>
            {/section} 
        </select>
            <section class="clear"></section>
        </dl>
         <section class="clear"></section>
         </div>                 
       <section class="clear"></section>
        <div id="checkfirst" style="display:none;">            
        <a href="javascript:void(0);" onClick="addFixedRateRow();" class="blue_btn margintp_bt admore" >Add more service sections </a>&nbsp;&nbsp; 
        <a href="javascript:void(0);" onClick="removeFixedRateRow();" class='org_btn admore'>Remove</a>
        </div>
              	 <!--<a href="javascript:void(0);" onClick="removeFixedRateRow();" class="txtColor">Remove</a>-->
        
         <input type="hidden" value="0" id="feeratedivValue" name="feeratedivValue" />
            <input type="hidden" name="feerateDiv" id="feerateDiv"  />
            
             
             
                   
       <!-- <section class="clear"></section>
        <dl>
                	<select class="input3" name="catname[]" id="catname1" onchange="showJobType();">
                    	<option value="">Select Industry category</option>
                        {section name=i loop=$newtradecategoryArray}
                        	<option value="{$newtradecategoryArray[i].id}">{$newtradecategoryArray[i].trade_category}</option>
                        {/section} 
                    </select>
            <section class="clear"></section>
        </dl>-->
		<section class="clear"></section>
      {*   <div id="hidediv" style="display:block;">       
        <h1 style="padding-top:35px;">select your skill</h1>
    	<dl>
           
                <div id="isJobType">
                	<select class="input3" multiple="multiple" name="jobtype[]" id="jobtype" style="height:250px;">                    	
                        {section name=i loop=$tradejobtypeArray}
                        	<option value="{$tradejobtypeArray[i].id}">{$tradejobtypeArray[i].trade_category}</option>
                        {/section} 
                    </select>
                 </div>   
            <section class="clear"></section>
        </dl>
		</div>      *}
	  <section class="clear"></section>
       </section> 
     <section><input type="submit" class="blue_btn margintp_bt rF" value="Next"  name="btnstep3" id="btnstep3"></section>
      <section class="clear"></section>
    </form>  
</section>
</section>
{include file=$footer}